import requests

API_URL = "https://api-inference.huggingface.co/models/gpt2"
API_TOKEN = "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"

headers = {"Authorization": f"Bearer {API_TOKEN}"}
response = requests.post(API_URL, headers=headers, json={"inputs": "你好， hugging face"})

print(response.text)